﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ICM_Purchase_Order_Installment.aspx.cs" Inherits="KPIS.GERP.GIMS.APP.APP_UI.Add_Form.ICM_Purchase_Order_Installment" %>
<%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %>
<%@ Register TagPrefix="custom" Namespace="KPIS.Customs.UI" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title></title>
    <LINK REL="StyleSheet" HREF="../../Styles/StyleSheet.css" TYPE="text/css">  
</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true" >
        </asp:ScriptManager>
        <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
            <script type="text/javascript" src="../../Scripts/Common.js"></script>
            <script type="text/javascript">
                var sumInput = null;
                var tempValue = 0.0;
                
                function Load(sender, args) {
                    sumInput = sender;
                }
                
                function BlurQty(qty, amount, pricePerQty) {
                    var textQty = $find(qty);
                    var textAmount = $find(amount);
                    var newQty;
                    if (textQty.get_value() != '')
                    {
                        newQty = textQty.get_value()
                    }
                    else
                    {
                        newQty = 0;
                    }
                    textAmount.set_value(newQty * pricePerQty);
                    sumInput.set_value(tempValue + textAmount.get_value());
                }

                function FocusQty(qty, amount, pricePerQty) {
                    var textQty = $find(qty);
                    var textAmount = $find(amount);
                    var newQty;
                    tempValue = sumInput.get_value() - textAmount.get_value();
                    if (textQty.get_value() != '')
                    {
                        newQty = textQty.get_value()
                    }
                    else
                    {
                        newQty = 0;
                    }
                    textAmount.set_value(newQty * pricePerQty);
                }
                
                function BlurPrice(price) {
                    var textPrice = $find(price);
                    sumInput.set_value(tempValue + (textPrice.get_value()));
                }

                function FocusPrice(price) {
                    var textPrice = $find(price);
                    tempValue = sumInput.get_value() - (textPrice.get_value());
                }
            </script>
        </telerik:RadCodeBlock>
        <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" BackgroundPosition="None" Skin="Outlook">
        </telerik:RadAjaxLoadingPanel>
        <telerik:RadAjaxManager runat="server" ID="RadManager1">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="panelCommand_Item">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="panel_Item" LoadingPanelID="RadAjaxLoadingPanel1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>
        <asp:Panel ID="panelHidden" runat="server">
            <asp:HiddenField ID="hdSeq" runat="server" Value="" />
        </asp:Panel>
        <asp:Panel ID="panel_Item" runat="server">
            <table style="width: 98%;" cellpadding="0" cellspacing="0">
                <tr valign="top">
                    <td valign="top">
                        <asp:Panel ID="panelCommand_Item" runat="server">
                            <div class="bigModuleRight">
                                <div class="bigModuleBottomRight">
                                    <table>
                                        <tr class="command-list">
                                            <td class="command-item" style="border: none">
                                                <asp:LinkButton ID="Edit_Item" runat="server" CssClass="LinkButton"  OnClick="Edit_Item_Click">
                                                    <img style="border:0px;vertical-align:middle;" alt="" src="../Image/Grid/Edit.gif" />&nbsp;&nbsp;แก้ไขข้อมูล
                                                </asp:LinkButton>
                                            </td>
                                            <td class="command-item" style="border: none">
                                                <asp:LinkButton ID="EditSave_Item" runat="server" CssClass="LinkButton" Visible="false" onclick="EditSave_Item_Click">
                                                    <img style="border:0px;vertical-align:middle;" alt="" src="../Image/Grid/Cmd_Save.gif" />&nbsp;&nbsp;บันทึกข้อมูล
                                                </asp:LinkButton>
                                            </td>
                                            <td class="command-item">
                                                <asp:LinkButton ID="Cancel_Item" runat="server" CssClass="LinkButton" Visible="false" onclick="Cancel_Item_Click">
                                                    <img style="border:0px;vertical-align:middle;" alt="" src="../Image/Grid/Cancel.gif" />&nbsp;&nbsp;ยกเลิก
                                                </asp:LinkButton>
                                            </td>
                                        </tr>
                                    </table>
                                </div>
                            </div>        
                        </asp:Panel>
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:Panel ID="panelData_Item" runat="server">
                            <div class="bigModuleRight">
                                <div class="bigModuleBottomRight">
                                    <asp:Panel ID="panelHeaderList1" runat="server">
                                        <div class="header-grid">
                                            <asp:Label ID="Label3" runat="server" Text="ข้อมูลรายละเอียดในงวดที่ "></asp:Label>
                                            <asp:Label ID="lblInstallNumber" runat="server"></asp:Label>
                                        </div>
                                    </asp:Panel>
                                    <asp:Panel CssClass="panelGrid" ID="panelGrid_Item" runat="server" ScrollBars="Vertical" Visible="true">
                                        <div align="center">
                                            <telerik:RadGrid CssClass="RadGrid" ID="Grid_Item" runat="server" AllowFilteringByColumn="true"
                                            AllowMultiRowSelection="True" AllowPaging="false" AllowSorting="True"
                                            AutoGenerateColumns="False" EnableAJAX="True" ShowFooter="true"
                                            GridLines="None" ShowStatusBar="false" Skin="Outlook" Width="95%"
                                            OnItemCommand="Grid_Item_ItemCommand" OnItemDataBound="Grid_Item_ItemDataBound">
                                                <MasterTableView GroupLoadMode="Client" AllowMultiColumnSorting="true" Width="100%" NoMasterRecordsText="<div align=center><font color=gray><i>ไม่มีข้อมูล</i></font></div>">
                                                    <PagerStyle Mode="NextPrevNumericAndAdvanced" />
                                                    <Columns>
                                                        <telerik:GridBoundColumn AutoPostBackOnFilter="true" 
                                                            CurrentFilterFunction="Contains" DataField="InfoBidderQuotation.InfoBidder.InfoVat.Name" 
                                                            FilterControlWidth="100%" Groupable="true" 
                                                            GroupByExpression="InfoBidderQuotation.InfoBidder.InfoVat.Name Group By InfoBidderQuotation.InfoBidder.InfoVat.Seq" 
                                                            HeaderText="ฐานภาษี" ShowFilterIcon="false" UniqueName="InfoBidderQuotation.InfoBidder.InfoVat.Name" 
                                                            Visible="false">
                                                            <HeaderStyle HorizontalAlign="Center" />
                                                            <ItemStyle HorizontalAlign="Left" />
                                                        </telerik:GridBoundColumn>
                                                        <telerik:GridTemplateColumn DataField="InfoBidderQuotation.InfoPrItem.InfoItem.Name" UniqueName="InfoBidderQuotation.InfoPrItem.InfoItem.Name" HeaderText="รายการพัสดุ" AutoPostBackOnFilter="true" 
                                                            CurrentFilterFunction="Contains" ShowFilterIcon="false" FilterControlWidth="100%">
                                                            <ItemTemplate> 
                                                                <asp:Label ID="lblItem" runat="server" Text='<%# Eval("InfoBidderQuotation.InfoPrItem.InfoItem.Name") %>'>
                                                                </asp:Label> 
                                                            </ItemTemplate>
                                                            <HeaderStyle HorizontalAlign="Center" Width="100px" />
                                                            <ItemStyle HorizontalAlign="Left" />
                                                            <FooterStyle HorizontalAlign="Right" />
                                                            <FooterTemplate>
                                                                <asp:Label ID="Label21" CssClass="font-label" runat="server" Font-Bold="true" Text="วงเงินในงวด :">
                                                                </asp:Label>
                                                            </FooterTemplate>
                                                        </telerik:GridTemplateColumn>
                                                        <telerik:GridTemplateColumn DataField="Descr" UniqueName="Descr" HeaderText="รายละเอียด" AutoPostBackOnFilter="true" 
                                                            CurrentFilterFunction="Contains" ShowFilterIcon="false" FilterControlWidth="100%">
                                                            <ItemTemplate> 
                                                                <asp:Label ID="lblDescr" runat="server" Text='<%# Eval("Descr") %>' Visible='<%# !(bool) IsItemInEditMode %>'>
                                                                </asp:Label> 
                                                                <asp:TextBox ID="txtDescr" runat="server" TextMode="MultiLine" Width="98%" Height="50px" Text='<%# Eval("Descr") %>' Visible='<%# IsItemInEditMode %>'>
                                                                </asp:TextBox> 
                                                            </ItemTemplate>
                                                            <HeaderStyle HorizontalAlign="Center" />
                                                            <ItemStyle HorizontalAlign="Left" />
                                                        </telerik:GridTemplateColumn>
                                                        <telerik:GridTemplateColumn UniqueName="Qty" HeaderText="จำนวน<br>ส่งมอบ" AutoPostBackOnFilter="true" 
                                                            CurrentFilterFunction="Contains" ShowFilterIcon="false" FilterControlWidth="100%">
                                                            <ItemTemplate> 
                                                                <asp:Label ID="lblQty" runat="server" Text='<%# Eval("Qty", "{0:N0}") %>' Visible='<%# !(bool) IsItemInEditMode %>'>
                                                                </asp:Label>
                                                                <telerik:RadNumericTextBox ID="txtQty" runat="server" Text='<%# Eval("Qty", "{0:N0}") %>' NumberFormat-DecimalDigits="0" Skin="Outlook" Width="95%" Visible='<%# IsItemInEditMode %>'>
                                                                </telerik:RadNumericTextBox>
                                                            </ItemTemplate>
                                                            <HeaderStyle HorizontalAlign="Center" Width="60px" />
                                                            <ItemStyle HorizontalAlign="Right" />
                                                        </telerik:GridTemplateColumn>
                                                        <telerik:GridBoundColumn DataField="InfoBidderQuotation.InfoPrItem.InfoItem.InfoUnit.Name" 
                                                            AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="false"
                                                            FilterControlWidth="100%"
                                                            HeaderStyle-HorizontalAlign="Center" HeaderText="หน่วย" 
                                                            UniqueName="InfoBidderQuotation.InfoPrItem.InfoItem.InfoUnit.Name">
                                                            <HeaderStyle HorizontalAlign="Center" Width="60px" />
                                                            <ItemStyle HorizontalAlign="Left" />
                                                        </telerik:GridBoundColumn>
                                                        <telerik:GridBoundColumn DataField="PriceInVat" DataFormatString="{0:N3}"
                                                            AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="false"
                                                            FilterControlWidth="100%"
                                                            HeaderStyle-HorizontalAlign="Center" HeaderText="ราคาต่อหน่วย<br>รวมภาษี(บาท)" 
                                                            UniqueName="PriceInVat">
                                                            <HeaderStyle HorizontalAlign="Center" Width="90px" />
                                                            <ItemStyle HorizontalAlign="Right" />
                                                        </telerik:GridBoundColumn>
                                                        <telerik:GridTemplateColumn DataField="NetAmount" UniqueName="NetAmount" HeaderText="ราคาสุทธิ<br>(บาท)" AutoPostBackOnFilter="true" 
                                                            CurrentFilterFunction="Contains" ShowFilterIcon="false" FilterControlWidth="100%">
                                                            <ItemTemplate> 
                                                                <asp:Label ID="lblNetAmount" runat="server" Text='<%# Eval("NetAmount", "{0:N3}") %>' Visible='<%# !(bool) IsItemInEditMode %>'>
                                                                </asp:Label> 
                                                                <telerik:RadNumericTextBox ID="txtNetAmount" runat="server" Skin="Outlook" Width="95%" Text='<%# Eval("NetAmount") %>' NumberFormat-DecimalDigits="3" Visible='<%# IsItemInEditMode %>'>
                                                                </telerik:RadNumericTextBox>
                                                            </ItemTemplate>
                                                            <HeaderStyle HorizontalAlign="Center" Width="100px" />
                                                            <ItemStyle HorizontalAlign="Right" />
                                                            <FooterStyle HorizontalAlign="Right" />
                                                            <FooterTemplate>
                                                                <asp:Label CssClass="font-label" ID="lblTotalNetAmount" runat="server" Font-Bold="true" Visible='<%# !(bool) IsItemInEditMode %>'>
                                                                </asp:Label>
                                                                <telerik:RadNumericTextBox ID="txtTotalNetAmount" NumberFormat-DecimalDigits="3" runat="server" ReadOnly="true" Skin="Outlook" Width="95%" Visible='<%# IsItemInEditMode %>'>
                                                                    <clientevents onload="Load" />
                                                                </telerik:RadNumericTextBox>
                                                            </FooterTemplate>
                                                        </telerik:GridTemplateColumn>
                                                        <telerik:GridBoundColumn DataField="InfoBidderQuotation.InfoBidder.InfoVat.Seq" 
                                                            HeaderStyle-HorizontalAlign="Center" UniqueName="InfoBidderQuotation.InfoBidder.InfoVat.Seq" 
                                                            Visible="false">
                                                            <HeaderStyle HorizontalAlign="Center" />
                                                        </telerik:GridBoundColumn>
                                                        <telerik:GridBoundColumn DataField="InfoBidderQuotation.InfoBidder.VatPercent" 
                                                            HeaderStyle-HorizontalAlign="Center" UniqueName="InfoBidderQuotation.InfoBidder.VatPercent" 
                                                            Visible="false">
                                                            <HeaderStyle HorizontalAlign="Center" />
                                                        </telerik:GridBoundColumn>
                                                        <telerik:GridBoundColumn DataField="PriceExVat" DataFormatString="{0:N3}"
                                                            HeaderStyle-HorizontalAlign="Center" UniqueName="PriceExVat" 
                                                            Visible="false">
                                                            <HeaderStyle HorizontalAlign="Center" />
                                                        </telerik:GridBoundColumn>
                                                        <telerik:GridBoundColumn DataField="ExVatAmount" DataFormatString="{0:N3}"
                                                            HeaderStyle-HorizontalAlign="Center" UniqueName="ExVatAmount" 
                                                            Visible="false">
                                                            <HeaderStyle HorizontalAlign="Center" />
                                                        </telerik:GridBoundColumn>
                                                        <telerik:GridBoundColumn DataField="InfoBidderQuotation.Seq"
                                                            HeaderStyle-HorizontalAlign="Center" UniqueName="InfoBidderQuotation.Seq" 
                                                            Visible="false">
                                                            <HeaderStyle HorizontalAlign="Center" />
                                                        </telerik:GridBoundColumn>
                                                        <telerik:GridBoundColumn DataField="InfoBidderQuotation.InfoPrItem.Seq"
                                                            HeaderStyle-HorizontalAlign="Center" UniqueName="InfoBidderQuotation.InfoPrItem.Seq" 
                                                            Visible="false">
                                                            <HeaderStyle HorizontalAlign="Center" />
                                                        </telerik:GridBoundColumn>
                                                    </Columns>
                                                </MasterTableView>
                                                <ClientSettings EnableRowHoverStyle="true" >
                                                    <Selecting AllowRowSelect="True" />
                                                </ClientSettings>
                                            </telerik:RadGrid>
                                        </div>
                                        <br />
                                    </asp:Panel>
                                </div>
                            </div>
                        </asp:Panel>
                    </td>
                </tr>
            </table>
        </asp:Panel>
    </form>
</body>
</html>
